#include <wchar.h>
#include "Syscall.h"
#include "Private.h"
#include "Database.h"
#include "System.h"

/// <summary>
/// Locals
/// </summary>
Database groups;

/// <summary>
/// The GetGroupID function 
/// returns the real group ID
/// of the calling process.
/// </summary>
GID GetGroupID(void)
{
	GID gid = -1;
	if ((gid = Syscall0(__NR_getgid32)) < 0)
		return -1;
	return gid;
}

/// <summary>
/// The GetGroupFromID function 
/// returns the real user ID 
/// of the current process.
/// </summary>
int GetGroupFromID(GID gid)
{
	if (gid < 0)
		return -1;

	//if (user == NULL)
	//	return -1;

	if (DatabaseOpen(DATABASE_GROUPS, &groups) < 0)
		return -2;

	return 0;
}